#include "Actors.h"




bool BaseActor::VAddComponent(ActorComponentPtr ActorComponent)
{
	dynamic_cast<BaseActorComponent*>(ActorComponent.get())->m_pOwner = this;
	BaseActor::m_ComponentList.push_back(ActorComponent);
	return true;
}
bool BaseActor::VRemoveComponent()
{
	
	return true;
}

bool BaseActor::VOnUpdate(float fTime)
{
	ActorComponentList::iterator i = m_ComponentList.begin();
	while(i != m_ComponentList.end())
	{
		(*i)->VOnUpdate(fTime);
		++i;
	}
	return true;
}
ActorComponentPtr BaseActor::FindComponent(const ComponentType type)
{
	ActorComponentList::iterator i = m_ComponentList.begin();
	while(i != m_ComponentList.end())
	{
		if((*i)->VGetComponentType() == type)
		{
			return (*i);
		}
		++i;
	}
	return ActorComponentPtr();
}
